/*
 * Copyright (C) 2008-2011 CBDP Consortium
 * 
 * All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.
 * 
 * This software consists of contributions made by many individuals, 
 * listed below:
 *
 * Author: 	Xabier Laiseca <xabier.laiseca@deusto.es>
 * 			David Ausín <david.ausin@deusto.es>
 */
package cbdp.server.contextreasoner;

import java.io.InputStream;
import java.util.Collection;
import java.util.Map;

import cbdp.server.contextreasoner.exceptions.ReasonerException;

/**
 * The <code>Reasoner</code> manages the rules of the system. It allows adding/deleting rules and launching them.
 * @author Xabier Laiseca (University of Deusto)
 *
 */
public interface Reasoner
{
	//public final static String ONTOLOGY_CLASSES_FILTER = "ont.classes";
	//public final static String ONTOLOGY_CLASSES_FILTER = "ont.properties";
	/**
	 * Creates a rule set with the specified rules.
	 * @param rules the rules of the rule set.
	 * @param filter the filter to match to launch the rules automatically.
	 * @return the identifier of the reasoner
	 * @throws ReasonerException thrown when the rules can not be added.
	 */
	public String createRuleSet(final InputStream rules, final Map<String,Collection<String>> filter) throws ReasonerException;
	
	public void startRuleSet(final String ruleSetName);
	public void stopRuleSet(final String ruleSetName);
	
	/**
	 * Returns the names of the created rule sets.
	 * @return the names of the created rule sets.
	 */
	public Collection<String> getRuleSetNames();
	
	/**
	 * Destroys the specified rule set.
	 * @param ruleSetName the name of the rule set.
	 * @throws ReasonerException thrown when the rule set can not be deleted.
	 */
	public void destroyRuleSet(final String ruleSetName) throws ReasonerException;
	
	
	/**
	 * Forces the execution of the rules of the specified rule set.
	 * @throws ReasonerException thrown when the rules can not be correctly launched.
	 */
	public void forceRuleSetLaunching(final String ruleSetName) throws ReasonerException;
	
	public void launchRuleSets();
}
